﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium;
using AutoTestingFramework.Core.WebDrivers;
using AutoTestingFramework.Core.Configurations;

namespace AutoTestingFramework.Core
{
    public abstract class TestBase
    {

        public IWebDriver webBroswer;

        public TestBase()
        {
            webBroswer = WebDriverBootstrap.Bootstrapper.Start();
        }
        public TestBase(WebBroswerType webBroswerType)
        {
            webBroswer = WebDriverBootstrap.Bootstrapper.Start(webBroswerType);
        }
        /// <summary>
        /// 
        /// </summary>
        public string BaseUrl { get; set; }

        public AutoTestingConfiguration Config
        {
            get { return AutoTestingConfiguration.Current; }
        }

        public WebDriverConfiguration WebDriverConfig
        {
            get { return WebDriverConfiguration.Current; }
        }
        
        /// <summary>
        /// This destructor will close all the windows and dispose the broswer resource.
        /// </summary>
        ~TestBase()
        {
            webBroswer.Quit();
            webBroswer.Dispose();
        }
    }
}
